import os
import sqlite3

__author__ = 'gongqf'
print os.getcwd()
if os.path.exists(r'e:\web\flask\topshipping'):
    os.chdir(r'e:\web\flask\topshipping')
elif os.path.exists(r'l:\web\flask\topshipping'):
    os.chdir(r'l:\web\flask\topshipping')
elif os.path.exists(r'g:\web\flask\topshipping'):
    os.chdir(r'g:\web\flask\topshipping')

conn=sqlite3.connect('topshipping.db3')

lines=open(r'static\line.txt').readlines()
for line in lines:
    print line.decode('gbk').strip('\n')

    conn.execute('replace into line(linename) values(?)',(line.decode('gbk').strip('\n'),))
conn.commit()